Skip to content

统计每分钟 Domain 出现安全的次数

通过 time_series 函数将 time 对齐到分钟( time 为系统字段,日志采集的时间,默认为秒时间戳),用 security_check_domain 函数查询 Domain 是否安全,用 count_if 函数判断并统计数量,通过线图进行展示,X 轴设置为 time,左 Y 轴选择”安全总数“

SQL
status : * | 
SELECT 
  count_if(
    security_check_domain (http_referer) != 0
  ) AS "安全总数", 
  time_series(__time__, '1m', '%H:%i:%s', '0') as time 
GROUP BY 
  time

SQL查询结果样例:

样例图片